#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableUnionBuildingLevDao:DaoBase<TableUnionBuildingLev>
    {
        public override string GetFileName()
        {
            return "TableUnionBuildingLev.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableUnionBuildingLev>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableUnionBuildingLev model)
        {
            if (!cacheOneIndex.ContainsKey(model.buildingType.ToString()))
            {
                cacheOneIndex[model.buildingType.ToString()] = new List<TableUnionBuildingLev>();
            }
            cacheOneIndex[model.buildingType.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableUnionBuildingLev model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.id)) UnityEngine.Debug.LogError("数据表id重复:TableUnionBuildingLev->id: " + model.id);
            #endif
            cachePrimaryInt[model.id] = model;
        }
        protected override TableUnionBuildingLev ParseRowData(string[] rowData)
        {
            TableUnionBuildingLev data = new TableUnionBuildingLev();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.id = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.buildingType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.level = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.upgradeCost = string.Intern(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.upgradeTime = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.upgradeExp = int.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.levelEffect = string.Intern(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.upGradingPath = string.Intern(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.modelPath = string.Intern(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.plotId = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.showObstacle = rowData[10];
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.hideObstacle = rowData[11];
            }
            return data;
        }
    }
}
